﻿Option Explicit On
Module LoggerFactory


    '*******************************************************************************************
    '* CLASS_MODULE:    LoggerFactory
    '* AUTHOR:          Cliff Gibb - EverAge Consulting Inc. - cgibb@everage.ca
    '*
    '* PURPOSE:         To create a logger and set the defaults for the object.
    '*******************************************************************************************

    ' Constant log levels
    Public Const INFO_LEVEL% = 1
    Public Const WARN_LEVEL% = 2
    Public Const ERROR_LEVEL% = 3
    Public Const FATAL_LEVEL% = 4
    Public Const DISABLE_LOGGING% = 5

    ' The application-specific defaults
    Const DEFAULT_LOG_FILE_PATH$ = "C:\multiple_reports_logger.log" ' the default log file path
    Const DEFAULT_LOG_LEVEL% = DISABLE_LOGGING 'DISABLE_LOGGING or INFO_LEVEL for debugging
    '*******************************************************************************************
    '* MODULE:    getLogger
    '*
    '* PURPOSE:   To return a logger object with the defaults set.
    '*
    '* PARAMETERS: sSubName$ - the subname that will be used as an identifier within the log file.
    '*******************************************************************************************
    Public Function getLogger(ByVal sSubName$) As Logger
        Dim oLogger As New Logger
        oLogger.SubName = sSubName

        ' Defaults to the specified values - but may be overridden before used
        oLogger.LogLevel = DEFAULT_LOG_LEVEL
        oLogger.LogFilePath = DEFAULT_LOG_FILE_PATH

        getLogger = oLogger
    End Function


End Module
